package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.client.impl.UserDegradeFeignClient;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import com.atguigu.tingshu.vo.user.UserPaidRecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(value = "service-user", path = "api/user", fallback = UserDegradeFeignClient.class)
public interface UserFeignClient {
    /**
     * 获取用户信息vo
     *
     * @param userId 用户ID
     * @return {@link Result<UserInfoVo>}
     */
    @GetMapping("/userInfo/getUserInfoVo/{userId}")
    public Result<UserInfoVo> getUserInfoVo(@PathVariable Long userId);

    /**
     * getuser是付费轨道
     *
     * @param userId            用户ID
     * @param albumId           专辑ID
     * @param needcheckTrackIds 需要检查跟踪ID
     * @return {@link Result<Map<Long, Integer>>}
     */
    @PostMapping("/userInfo/userIsPaidTrack/{userId}/{albumId}")
    public Result<Map<Long, Integer>> getuserIsPaidTrack(@PathVariable Long userId,
                                                         @PathVariable Long albumId,
                                                         @RequestBody List<Long> needcheckTrackIds);

    /**
     * 获取vip服务配置
     *
     * @param id id
     * @return {@link Result<VipServiceConfig>}
     */
    @GetMapping("/getVipServiceConfig/{id}")
    public Result<VipServiceConfig> getVipServiceConfig(@PathVariable Long id);

    @GetMapping("/getalbumisPaidorNot/{albumId}")
    public Result<Boolean> getalbumisPaidorNot(
            @PathVariable Long albumId);

    @GetMapping("/getUserIsVipOrNot/{albumId}")
    public Result<Boolean> getUserIsVipOrNot(
            @PathVariable Long albumId);

    @PostMapping("/getuserIsPaidTrackIdList/{albumId}")
    public Result<List<Long>> getuserIsPaidTrackIdList(
            @PathVariable Long albumId, @RequestBody List<Long> needcheckIdList);

    @PostMapping("/addUserPaidRecord")
    public Result addUserPaidRecord(@RequestBody UserPaidRecordVo userPaidRecordVo);
}
